require(['config'],()=>{
    require(['jquery','pAjax'],()=>{
class newProduct{
    constructor(){
        this.div = document.getElementById('newProduct')
        this.init()
    }
    init(){
        this.request()
        // this.totalNum()
    }
    request(){
        pAjax({url: '/api/goods.json'})
        .then(data=>{
            let res = JSON.parse(data)
            res = res.slice(0, 21)
            this.render(res)
        })
    }
    render(data){
        data.forEach(item=>{
           
            this.div.innerHTML +=`
            <div class="editionCenter">
          <div class="newProduct_box" id="newProduct_box">
            <div class="pro_left">
             <a href="/html/detail.html" class="left_a" target="_blank">
             <div class="p_img_lg">
              <img alt=" OLAY小白瓶烟酰胺精华液光感30ml/PROX淡斑小白瓶40ml" class="img_600" src="${item.img_small_logo}" >
             </div>
            </a>
            </div>
            <!-- 右 -->
                <div class="pro_right">
    <a href="/html/detail.html">
        <div class="pro_right_top">
        <div class="pro_right_top_left">
            <img src="/img/hanguo.png" alt="">
            <ul>
                <li>korea</li>
                <li>韩国品牌</li>
            </ul>
        </div>
        <span class="text">距结束还剩</span>
        <span class="countDown">倒计时还剩00天00时00分00秒</span>
        </div>
        <p class="f15">${item.title}</p>
        <p class="des"> ${item.title}</p>
        <div class="pro_right_down">
            <div class="down_top">
                <em class="big_pic">
                    <span class="rmb">￥</span>
                    ${item.price}
                    <span class="give">包邮</span>
                </em>
            </div>
            <div class="down_down">
                <span>
                    <em>2413</em>
                    人已购买
                </span>
            </div>
        </div>
    </a>
</div>
</div>
</div>
        `
        })
        
    }
}
new newProduct()
})
})  